package com.yawn.demomybatis.controller;

import com.yawn.demomybatis.dao.BookDao;
import com.yawn.demomybatis.dao.SchoolDao;
import com.yawn.demomybatis.entity.Book;
import com.yawn.demomybatis.entity.School;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/book")
public class BookController {

    @Autowired
    private BookDao bookDao;

    @GetMapping("/list")
    public List<Book> list(int stuId) {
        return bookDao.listByOwner(stuId);
    }
}
